package zhengqc.search;

public class LinearSearch<E extends Comparable<E>> extends Search<E> {
    public LinearSearch() {
        this.searchName = "LinearSearch";
    }

    @Override
    public int search(E[] data, E target) {
        for (int i = 0; i < data.length; ++i) {
            if (data[i].equals(target)) {
                return i;
            }
        }
        return -1;
    }
}
